package com.hyt.it.ogt.kq.common.bm.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author huangwu
 *
 */
public class ThreadLocalProvider {
    private static ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<>();
    public static String STUDENTSYNCKWDATAKEY = "student_sync_kwdata_key";

    public static void set(String key, Object object) {
        Map<String, Object> map = get();
        if (map == null) {
            map = new HashMap<>();
        }
        map.put(key, object);
        threadLocal.set(map);
    }

    private static Map<String, Object> get() {
        return threadLocal.get();
    }

    public static Object getByKey(String key) {
        Object object = null;
        Map<String, Object> map = threadLocal.get();
        if (map != null) {
            object = map.get(key);
        }
        return object;
    }

    public static void remove() {
    	threadLocal.remove();
    }
}
